class Solution(object):
    def majorityElement(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        now_value = nums[0]
        count = 1
        for i in range(1, len(nums)):
            if count == 0:
                now_value = nums[i]
                count = 1
            else:
                if nums[i] != now_value:
                    count -= 1
                else:
                    count += 1
        return now_value


data = Solution()
nums = [3,2,3]
print(data.majorityElement(nums))
